package logic;

import java.util.Vector;

import main.GameDef;

public class GameRules implements Rules, GameDef{

	public int currentPlayer() {
		return 0;
	}

	public int nextPlayer() {
		return 0;
	}

	public boolean isGameOver(Vector activePlayers) {
		return (activePlayers.size() == 1);
	}

	public static int availableAttacks(Player player){
		int numAttacks = 0;
		int pieceType;
		
		for(int i = 0; i < player.castle.size(); i++){
			pieceType = player.castle.get(i).type;
			if(pieceType == ID_CANNON || pieceType == ID_CATAPULT){
				numAttacks++;
			}
		}
		
		return numAttacks;
	}

	public static void updateGold(Player player){
		int gold = 100;
		int pieceType;
		
		for(int i = 0; i < player.castle.size(); i++){
			pieceType = player.castle.get(i).type;
			switch(pieceType){
				case ID_HOUSE:
					gold += 10;
					break;
				case ID_CATAPULT:
					gold--;
					break;
				case ID_CANNON:
					gold -= 2;
					break;
				case ID_ARMORY:
					
					break;
				case ID_INTERIOR:
					gold++;
					break;
			}
		}
		player.gold += gold;
	}

}
